package com.suarte.core;

import com.suarte.utils.Persistent;
import org.appfuse.model.BaseObject;

import javax.persistence.*;

/**
 * Created by IntelliJ IDEA.
 * User: Gcastillo
 * Date: Jan 2, 2011
 * Time: 10:03:21 AM
 * To change this template use File | Settings | File Templates.
 */

@Entity @Table(name = "sa_payment_types")
public class PaymentType extends BaseObject implements Persistent {
    private Long id;
    private String code;
    private String description;

    public PaymentType(){
    }

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "PAYMENT_TYPE_SEQ")
    @SequenceGenerator(name = "PAYMENT_TYPE_SEQ", sequenceName = "PAYMENT_TYPE_SEQ", allocationSize = 1)
    public Long getId() {
        return id;
    }

    @Column (name = "code")
    public String getCode(){
        return code;
    }

    @Column (name ="description")
    public String getDescription() {
        return description;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Override
    public String toString() {
        return description;
    }

    @Override
    public boolean equals(Object other) {
        if (other == this) {
            return true;
        }
        if (!(other instanceof PaymentType)) {
            return false;
        }
        PaymentType _i = (PaymentType) other;
        return id.equals(_i.id);
    }

    @Override
    public int hashCode() {
        return id.hashCode();
    }
}
